Skip to content

Modernize dev tooling (uv, Ruff, Pyrefly, pydantic v2, click 8, GH Actions)#16

Open
giancarlosisasi wants to merge 9 commits into
danger:masterfrom
giancarlosisasi:tooling-improvement
Open

Modernize dev tooling (uv, Ruff, Pyrefly, pydantic v2, click 8, GH Actions)#16
giancarlosisasi wants to merge 9 commits into
danger:masterfrom
giancarlosisasi:tooling-improvement

Conversation

@giancarlosisasi

@giancarlosisasi giancarlosisasi commented Jul 23, 2026

Copy link
Copy Markdown

Summary

Follow-up to #14

This PR modernizes danger-python's development toolchain and runtime dependencies, replacing the 2019-era stack (Poetry, black, isort, flake8, pylint, mypy, Travis) with current tools. What Danger does is unchanged; the goal is just to make the project easier to build, lint, type-check and test on modern Python.

Compatibility note: the package is still pre-1.0 (this bumps it to 0.2.0), so these changes fall within what semver allows for a 0.x release. The two things worth flagging are that the minimum Python is now 3.13, and the runtime deps move to pydantic v2 and click 8. Happy to adjust the Python floor if you'd prefer a gentler baseline.

Toolchain changes

Concern Before After
Env / deps / lockfile Poetry uv (uv.lock)
Lint + format black, isort, flake8, pylint Ruff
Type checking mypy Pyrefly
Python baseline 3.7 >=3.13
Runtime deps pydantic v1, click 7 pydantic v2, click 8
CI Travis GitHub Actions (3.13 / 3.14 matrix)
Config home setup.cfg pyproject.toml only

What is preserved

  • The 100% coverage gate. pyproject.toml keeps fail_under = 100 under [tool.coverage.report], so the suite still fails below full coverage.
  • The danger-js input/output JSON contract. The JSON fixtures under tests/fixtures/ are untouched. The only fixture edits are typing cleanups in the .py helpers (Dict[str, Any] becomes list[str], Optional[str] becomes str | None).
  • Public behavior and the danger-js shell-out flow.

CI

Adds .github/workflows/ci.yml with two jobs, both installing via uv sync --frozen: a quality job that runs ruff format --check, ruff check, and pyrefly check on Python 3.14, and a test job that runs pytest with the coverage gate across a 3.13 / 3.14 matrix. It also adds a new action.yml, updates the Dockerfile, and bumps actions/checkout to v4 in the existing danger.yml.

Notes for reviewers

Given the size, I'm happy to split this into smaller, independently reviewable PRs (uv, then Ruff, then Pyrefly, then pydantic v2, then click 8, then CI) if that's easier to review. I can also raise or lower the minimum Python version if a less aggressive baseline works better for you.

Also consolidate tooling config by moving from setup.cfg to pyproject.toml
- README: uv/ruff/pyrefly dev workflow, GitHub Actions CI badge + static Python 3.13|3.14 badge, Python 3.13+ requirements, GHA CI-step example (replacing Travis), checkout@v4
- CHANGELOG: 0.2.0 entry documenting the toolchain modernization and BREAKING Python/pydantic/click bumps
- pyproject/uv.lock: bump version 0.1.0 -> 0.2.0
Resolve the 50 pyrefly errors in tests/ that were downstream of the pydantic v2 Optional fields (closes task 4.6):
- builder.py: widen build_types param list[SchemaItem] -> Sequence[SchemaItem] (covariant, read-only) to accept list[SchemaObject]/list[SchemaEnum]
- fixtures/danger.py: fix **kwargs annotation (dict[str, Any] -> list[str])
- conftest.py: narrow patcher.fs; pass b'' instead of None to MockPopen stdout
- test_danger/test_models/test_plugins: assert-is-not-None narrowing guards for Optional model fields
- test_plugins: add explicit danger-property cache test (preserves plugins.py branch coverage)

Full gate green on Python 3.13 and 3.14: ruff format/check, pyrefly (0 errors), pytest (100% coverage).
@giancarlosisasi

giancarlosisasi commented Jul 23, 2026

Copy link
Copy Markdown
Author

Hi @orta , there is the MR 🚀

I have two questions:

  • I think the next change could be to release this (I need to set up that action). I think it should be a separate MR.
  • After checking the code, I can see it depends on Node.js and danger-js. Is there a possibility that we could implement all those features natively here in Python? (lot of work, but I think it's possible)

THanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant